Ext.define('Admin.view.trade.ContractController', {
	        extend : 'Admin.app.BaseController',
	        alias : 'controller.contract',

	        onTradeChange : function(comp, newValue, oldValue) {
		        var me = this, vm = me.getViewModel();
		        var record = vm.get('record');
		        var store = me.getStore('contractListStore');
		        store.proxy.extraParams = {
			        id : newValue,
			        buyer : record.data.id
		        };
		        store.reload();

		        var detialStore = vm.getStore('contractDetailStore');
		        detialStore.removeAll();
		        detialStore.proxy.extraParams = {}
	        },

	        onContractSelect : function(model, record, index, eOpts) {
		        var me = this, vm = me.getViewModel();
		        var store = vm.getStore('contractDetailStore');
		        store.proxy.extraParams = {
			        id : record.data.id
		        }
		        store.reload();
	        },

	        cellmousedown : function(grid, td, cellIndex, record) {
		        var me = this, vm = me.getViewModel();
		        var store = vm.getStore('programPropertyStore');
		        store.proxy.extraParams = {
			        id : record.data.id
		        }
		        store.reload();
	        },

	        onContractRefreshClick : function(btn) {
		        btn.ownerCt.ownerCt.getStore().reload();
		        var me = this, vm = me.getViewModel();
		        var detialStore = vm.getStore('contractDetailStore');
		        detialStore.removeAll();
		        detialStore.proxy.extraParams = {}
	        },

	        onContractDetailRefreshClick : function(btn) {
		        var me = this, vm = me.getViewModel();
		        var contractGrid = me.getReferences().contractlist;
		        if (contractGrid.getSelection().length == 0) {
			        return;
		        }
		        btn.ownerCt.ownerCt.getStore().reload();
	        }
        });